package net.kesumu.yushabuserver.entity;

import java.util.Comparator;


public class Chat implements Comparator<Chat>{
    YushabuSession yushabuSession;
    YushabuMessage latestYushabuMessage;
    int unreadedMessageNumber;
    public YushabuSession getYushabuSession() {
        return yushabuSession;
    }
    public void setYushabuSession(YushabuSession yushabuSession) {
        this.yushabuSession = yushabuSession;
    }
    public YushabuMessage getLatestYushabuMessage() {
        return latestYushabuMessage;
    }
    public void setLatestYushabuMessage(YushabuMessage latestYushabuMessage) {
        this.latestYushabuMessage = latestYushabuMessage;
    }
    @Override
    public int compare(Chat left, Chat right) {
        return right.getLatestYushabuMessage().getSendTime().toString().compareTo(
               left.getLatestYushabuMessage().getSendTime().toString());
    }
    public int getUnreadedMessageNumber() {
        return unreadedMessageNumber;
    }
    public void setUnreadedMessageNumber(int unreadedMessageNumber) {
        this.unreadedMessageNumber = unreadedMessageNumber;
    }
}
